function getBooks() {
    $.ajax({
        url: "./books?page=1&size=6",
        type: "GET",
        success: showBooks,
        error: function(xhr, status, error) {
            console.error("ajax failed:" + error);
        }
    });
}

function showBooks(data, status) {
    //console.log(data);
    var books = data.books;
    for (var i=0; i<books.length; i++) {
        var book = books[i];
        console.log(book);
        var d = $("<div class='book-div'>");
        d.append("<img src='./upload/" + book.picture + "'></img>").append("<br><br>");
        d.append("书名：" + book.name).append("<br>");
        d.append("作者：" + book.author).append("<br>");
        d.append("价格：" + book.price).append("<br>");
        d.append("发行：" + book.publish).append("<br>");
        $("#bookTableContainer").append(d);
    }
}